package cn.wolfcode.service.impl;

import cn.wolfcode.domain.Customer;
import cn.wolfcode.domain.SysDictData;
import cn.wolfcode.mapper.CustomerMapper;
import cn.wolfcode.service.ICustomerService;
import cn.wolfcode.service.ISysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by XuHangBin
 */
@Service
public class CustomerServiceImpl implements ICustomerService {
    @Autowired
    private CustomerMapper customerMapper;

    @Override
    public List<Customer> selectAll() {
        return customerMapper.selectAll();
    }

    @Override
    public void saveOrUpdate(Customer customer) {
        if(customer.getId()==null){
            customerMapper.insert(customer);
        }else{
            customerMapper.update(customer);
        }
    }

    @Override
    public Customer get(Long id) {
        return customerMapper.get(id);
    }
}
